﻿function initLastestEntry() {
    var currentIndex = 1;
	var finished = true;
	var module = $("#lastest-entry");
	var info = $("#lastest-entry .info");
	module.find('.info .selected').show();
	module.find('.info .selected').removeClass('selected');

	module.find('.select-list a').click(function() {
	    var index = $(this).index();
	    var selected = index + 1;
	    var currentTab = module.find('.info .category:nth-child(' + currentIndex + ')');
	    var selectedTab = module.find('.info .category:nth-child(' + selected + ')');

	    //var absolute = currentTab;
	    //if (currentTab.width() >= selectedTab.width()) {
	    //    absolute = selectedTab;
	    //}
	    //absolute.css("position", "absolute");

	    // Change display on .select-list
	    module.find('.select-list a').each(function() {
	        if ($(this).index() != index) {
	            $(this).removeClass('selected');
	        } else {
	            $(this).addClass('selected');
	        }
	    });

	    // Change category
	    //currentTab.hide('drop', { direction: 'down' }, 1000);
	    //selectedTab.show('slide', { direction: 'top' }, 1000);
	    currentTab.hide('drop', { direction: 'left' }, 1000, function() {
	        selectedTab.show('slide', { direction: 'top' }, 1000);
	    });
	    //selectedTab.show('slide', { direction: 'top' }, 1000);
	    currentIndex = selected;
	    //absolute.css("position", "relative");
	});
}